﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace PES_TurnierManager
{
    /// <summary>
    /// Interaktionslogik für AddPlayerDialog.xaml
    /// </summary>
    public partial class AddPlayerDialog : Window
    {
        bool mDialogResult;

        public AddPlayerDialog()
        {
            mDialogResult = false;
            InitializeComponent();
        }

        public bool getDialogResult()
        {
            return mDialogResult;
        }

        public string getTeamName()
        {
            return mTeamNameBox.Text;
        }

        public string getPlayerName()
        {
            return mPLayerNameBox.Text;
        }

        private void ButtonClick(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;
            if (button.Name.Equals("mOK") && !mPLayerNameBox.Text.Equals(""))
            {
                mDialogResult = true;
            }
            else
                mDialogResult = false;

            Close();
        }

        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                if (!mPLayerNameBox.Text.Equals(""))
                {
                    mDialogResult = true;
                    Close();
                }
            }
        }
    }
}
